package com.inhim.pjhim.view;

import android.content.Context;

public class ProgressDialog {
    private static TransparentProgressDialog mProgressDialog;
    public static void showLoading(String text, Context context) {
        if (mProgressDialog == null) {
            mProgressDialog = new TransparentProgressDialog(context,text);
            mProgressDialog.getWindow().setDimAmount(0f);
            //mProgressDialog.setCancelable(false);
            mProgressDialog.setCanceledOnTouchOutside(false);
        }
        try{
            mProgressDialog.show();
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void hideLoading() {
        try {
            if (mProgressDialog != null && mProgressDialog.isShowing()) {
                try{
                    mProgressDialog.dismiss();
                    mProgressDialog=null;
                }catch (Exception e){
                    e.printStackTrace();
                }
                mProgressDialog=null;
            }
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}
